/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gsb.android;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import modele.Adapter;
import modele.DAO;
import modele.Medecin;
import org.xml.sax.SAXException;

/**
 *
 * @author sio
 */
public class AutreActivity extends ListActivity {
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.autrevue);
        TextView label = (TextView)findViewById(R.id.label);
        Intent inter = getIntent();
        String nom = inter.getStringExtra("Departement");
        label.setText(nom);
         List<Medecin> lesMeds;
        try {
            lesMeds = DAO.getLesMeds(nom);
            //Création de l'adapter
            Adapter adapter = new Adapter(lesMeds, this);
            setListAdapter(adapter);
            
        } catch (ParserConfigurationException ex) {
            Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SAXException ex) {
            Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
